UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's5fMnDchfPEpfS19Yq+oeWsYB2bd+bF12I1Wyg8FZYc='
WHERE
key_id = 'c59cc665b2d2481ae48cf7d2943b269ac977e1bd9cbd96e6698bd0579ffa0782'
AND (
token = 's5fMnDchfPEpfS19Yq+oeWsYB2bd+bF12I1Wyg8FZYc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)