UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3k8GFMkBddNRgRKy1mu5kHZZq+VtNBIlyllAjvA8qpA='
WHERE
key_id = '6ad05909e8c4c6bf2f32a7a82e3438e4b6be27536662180a438b9122b50c82d1'
AND (
token = '3k8GFMkBddNRgRKy1mu5kHZZq+VtNBIlyllAjvA8qpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)