UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e/qF40n4j60E9rBkXqH+I3veKujQ0lTMKEVyA+t1Wgw='
WHERE
key_id = 'a0ca941d1431326db2f8586767a1046f7894a92503126b9e45c4b34d75d68211'
AND (
token = 'e/qF40n4j60E9rBkXqH+I3veKujQ0lTMKEVyA+t1Wgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)