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

Query time 0.00026