UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJZtn+bGT1+rTzerawmqiXVdWkwpaqYa+sKPFDxkb7w=' 
WHERE 
  key_id = 'b26baee2b464a69bdb6f314af48cb17bfb4af968662680cd0aee356fc435df18' 
  AND (
    token = 'YJZtn+bGT1+rTzerawmqiXVdWkwpaqYa+sKPFDxkb7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019