UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pln6oHZqX2+U0/HAcvo9bn2pNoc66lN+mlY7W1yL8jg='
WHERE
key_id = 'e8da995f1640f1623535b0b37e892ea6dac1ddaa8faf61f46ca0012170464407'
AND (
token = 'pln6oHZqX2+U0/HAcvo9bn2pNoc66lN+mlY7W1yL8jg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)