UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UCtKyqALAtsyjZqjvG76h85icETr8+y+2NGFNOUciWY=' 
WHERE 
  key_id = '23c62e2cd440e45b64bbad057e3eb928f6d4eb8711450f8b961153d2f514d265' 
  AND (
    token = 'UCtKyqALAtsyjZqjvG76h85icETr8+y+2NGFNOUciWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031