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

Query time 0.00031