UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D8AstZZEN8AqTUjS4Honyvf/glALy0Uq/wE+LLZW1gk='
WHERE
key_id = 'daefcd609150caa28676573d6504e28c87e1c15d0c608784756ecf6425f35aac'
AND (
token = 'D8AstZZEN8AqTUjS4Honyvf/glALy0Uq/wE+LLZW1gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)