UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3DvzTVQaWkx5ro7v1YWapXGJ7mnQUWF0ahqzsUbhoo8='
WHERE
key_id = '2d6ac247f937f2b0116c87b38f3674935c281cf6e4b22ebfcadffca5a6213d2d'
AND (
token = '3DvzTVQaWkx5ro7v1YWapXGJ7mnQUWF0ahqzsUbhoo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)