UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oH5sOfEk9EgjN90dFACuRww8SX2/TsPv5mooB19rt8c='
WHERE
key_id = '0519581b374fea53b9d8baf13e61ce4743d2180044f4348b2ccabbf4b9bec564'
AND (
token = 'oH5sOfEk9EgjN90dFACuRww8SX2/TsPv5mooB19rt8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)