UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O5ftEBnojx5CXKcRNPh2ODONERc6voBt7E3WQVoNClY='
WHERE
key_id = '1e8d57ab421b1ed9a90beb501d3512219a550ce11e6e256d9e4e75dec04c9edc'
AND (
token = 'O5ftEBnojx5CXKcRNPh2ODONERc6voBt7E3WQVoNClY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)