UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wr8rG81AbW+Zx/b12vfCy9U2lWWQoelC21VHv9IY3g8='
WHERE
key_id = 'e67cf0115840ab397cccce15f9aa47a2b42ced91a8a725f894d8193aa3efac13'
AND (
token = 'wr8rG81AbW+Zx/b12vfCy9U2lWWQoelC21VHv9IY3g8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)