UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PdyQ9Xl5QKQnHexX8v6vTIQNH3lEbLZ46OTnTuAOezA='
WHERE
key_id = 'd1a87718761c70bf418c3d2d8146c6dbeafd09d5c1af49a02633d31948d4d44e'
AND (
token = 'PdyQ9Xl5QKQnHexX8v6vTIQNH3lEbLZ46OTnTuAOezA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)