UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cn4KqhgiiSWA8LT7U59f7im2F+l0jIkb5gFMWwOSRAc='
WHERE
key_id = 'a38390d44473308c26114b09f57deefddf546600e35f2fa723afc1ccf14f2127'
AND (
token = 'Cn4KqhgiiSWA8LT7U59f7im2F+l0jIkb5gFMWwOSRAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)