UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q42SdH0i8KoMjCn38AJhsHohO6FThAJEnvoRQrnx5f8='
WHERE
key_id = '8efcc765553acaca79820ca9a83bf335090f66a9831ee1103d33fc7301e0fd99'
AND (
token = 'q42SdH0i8KoMjCn38AJhsHohO6FThAJEnvoRQrnx5f8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)