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

Query time 0.00036