UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lHAi6qifJIuqEOH0g38NIklxIlzVA47fG29jeHT5tRE=' 
WHERE 
  key_id = '4199c6884e2fd4996e66a43fd390ddacadd018f6fea244654df3bac88e81bad1' 
  AND (
    token = 'lHAi6qifJIuqEOH0g38NIklxIlzVA47fG29jeHT5tRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030