UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XRdpYtDKHa1hpYP+pYLeN2QoNZ2Np67dmczIOZAyVu0='
WHERE
key_id = 'b5a50f59906da5210fa9d95d0f6a149fa1294b15dbab90908bc9164c8f6830e4'
AND (
token = 'XRdpYtDKHa1hpYP+pYLeN2QoNZ2Np67dmczIOZAyVu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)