UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OTOCAIv6kWUScGeX+yeVOuEGWW4aC0Kv58H5+ueq+A8='
WHERE
key_id = 'be5ad21d93894329c37a714424c9596cef708625c659723353d56f7a38debe50'
AND (
token = 'OTOCAIv6kWUScGeX+yeVOuEGWW4aC0Kv58H5+ueq+A8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)