UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wSr24LsG/tguEhw17r3Td+QQ8rdMjcNh0n8erPdQoYc=' 
WHERE 
  key_id = '796c53708a38e9844ac7d05087e97999d8962ddb4d9cee960a86da798bed3077' 
  AND (
    token = 'wSr24LsG/tguEhw17r3Td+QQ8rdMjcNh0n8erPdQoYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023