UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kMdfGggJ1zzbkZJoy7CIKB2D3N4S7lNIxtlaPxKt1S4=' 
WHERE 
  key_id = 'd45f43b9adc5d56eeb4bbd4439456c1a4ff28f806271ee827776408855714123' 
  AND (
    token = 'kMdfGggJ1zzbkZJoy7CIKB2D3N4S7lNIxtlaPxKt1S4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025