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