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