UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nouh0Yk7kiiawSPalrE+jBpr2GgktNdaRjhhYwzUL4o='
WHERE
key_id = 'cd3d3302f41d294f3432675c9d52227947730b1a2be846773e3021080c3bf12b'
AND (
token = 'Nouh0Yk7kiiawSPalrE+jBpr2GgktNdaRjhhYwzUL4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)