UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xyXOkJBFA9cYbXaAZT5a/LePxKY9hpGJ+ii2mcffG6E=' 
WHERE 
  key_id = 'b4df4e537d7dba885ee113b5c4775003a129c7c629fecd8ff312bbf144f37522' 
  AND (
    token = 'xyXOkJBFA9cYbXaAZT5a/LePxKY9hpGJ+ii2mcffG6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038