UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HcDT+SQs7mABhNxGXSF0RLEOfD5K5ZW3G97ikzHRqz4=' 
WHERE 
  key_id = '75cf76aa3190484214c33a5e71d710bc46445f103b966f09fe900f140296d4c9' 
  AND (
    token = 'HcDT+SQs7mABhNxGXSF0RLEOfD5K5ZW3G97ikzHRqz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049