UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sXV8Ek3x0q0+UABfFZ4BCY9VP4Q0JfYbY4eG3vSOAAI='
WHERE
key_id = '3b864933360b077a16bb7787c6080c8d0c22570ce3870238c0662fa17d42f125'
AND (
token = 'sXV8Ek3x0q0+UABfFZ4BCY9VP4Q0JfYbY4eG3vSOAAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)