UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xp/tifngahZhzXEjX+oCKzc8dVlIu+VyRY8CYZz14Yw='
WHERE
key_id = 'a2a3200add792d43acdc91fa0a495cc9da2a3321b151b0a23c2cce7710d0499c'
AND (
token = 'xp/tifngahZhzXEjX+oCKzc8dVlIu+VyRY8CYZz14Yw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)