UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/jn8WzEsEg/8vH6DL+1FOVl3XP0helKnFLbELlffQ70=' 
WHERE 
  key_id = '3dd186de3a0f112928a752a74944fb65c583163c41abc04048876f2f29abea57' 
  AND (
    token = '/jn8WzEsEg/8vH6DL+1FOVl3XP0helKnFLbELlffQ70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022