UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eip6976JG1yXIL54/iBsZ4Kb7VAIebzqZyJrf7mGnFs='
WHERE
key_id = 'd7e30d5e52ee77330c892943f5a01255d84c79ab53a54b9c64fc199998256657'
AND (
token = 'eip6976JG1yXIL54/iBsZ4Kb7VAIebzqZyJrf7mGnFs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)