UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZlyvUrxMXj2zgDxQBmMjVtJixYTgk4YOfHFubGXlEmk='
WHERE
key_id = '20e9037d522072e87b5f3a70afa9b504ecd3f1de9d56b645c14b3396acdf7ecc'
AND (
token = 'ZlyvUrxMXj2zgDxQBmMjVtJixYTgk4YOfHFubGXlEmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)