UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EoX38olkxaBziWPboXXI2ivscHGMwkls117lzMiSccc='
WHERE
key_id = '0e7bd6bba3a4b791c48b9f1cac20b23bb2d5ff75da82d8d9292e33dde9385fd1'
AND (
token = 'EoX38olkxaBziWPboXXI2ivscHGMwkls117lzMiSccc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)