UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ReN9KsuqDD+ajkpDFzoeC55g6Bonr7FhA/IeZumYeeY=' 
WHERE 
  key_id = '6d228d914eedc93ce82399713927926f0bf14e6952004e780f28fbbb82ac5733' 
  AND (
    token = 'ReN9KsuqDD+ajkpDFzoeC55g6Bonr7FhA/IeZumYeeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053