UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X3KeSkLe8+HOCqf5ABNNuQepibztcphXm0pT14I8m1g='
WHERE
key_id = '65d3a8c2443c039dc2ec1a93042970accd0ab51537d2421c9d8fd8ed05ed4bcd'
AND (
token = 'X3KeSkLe8+HOCqf5ABNNuQepibztcphXm0pT14I8m1g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)